package com.alex.aop.configByAnnotation;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Order(1)
@Aspect
@Component
public class ValidationAspect {

    @Before("execution(public int com.alex.aop.configByAnnotation.ArithmeticCalculator.*(..))")
    public void validateArgs(JoinPoint joinPoint) {
        List<Object> objects = Arrays.asList(joinPoint.getArgs());
        System.out.println("validate: " + objects);
    }
}
